fix: preserve persistence health across page splits - #61
Merged
Conversation
added 14 commits
August 8, 2026 05:59
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Incident reproduced
AgencyZero 3.20 hit
page should be available in table of contentswhile repeatedly upserting variable-sized settings values. The KV persistence worker died, but the process continued accepting writes until quit attempted a drain roughly twenty minutes later.The added
repeated_string_upsertregression uses the same key/value shape, 256 keys, and 1,000 varying-size upserts. It deterministically reproduced the original panic before the fix and now passes.A separate lifecycle test deliberately panics a persistence worker and verifies that
wait_for_failurereports the terminal error immediately.Root cause
A split can change a physical page maximum, then a later removal in the same persistence batch can lower it again. A subsequent insert may still reference the pre-split/pre-removal maximum. The table-of-contents lookup had already discarded that historical identity, so the worker panicked. The fix keeps batch-scoped aliases and resolves updates through the current buffered page key.
Verification
cargo test: 174 library tests, 522 integration tests passed; 4 ignoredcargo clippy --all-targets -- -D warningsReview focus
Please scrutinize alias lifetime and collision behavior, same-batch split/remove/insert ordering, terminal lifecycle transitions, panic payload conversion, and whether any generated table API can miss a worker failure.